//Native rules implementations
#ifndef NATIVE_HPP
#define NATIVE_HPP

#ifdef _MSC_VER
#pragma once
#endif

#include "rules.hpp"

class JAMLIB_EXPORT native_rule_entry
{
	friend void create_natives_for_context(jam_context *);
	friend class native_rule;
public:
	typedef void(*rule_func)(jam_frame *frame,jam_list *res);
	typedef fixed_size_list<jam_string,JAM_MAX_PARAMS> param_name_list;
	typedef fixed_size_list<jam_rule::param_type,JAM_MAX_PARAMS> param_type_list;

	native_rule_entry(const jam_string &module, const jam_string &rule_name, rule_func rule);
	native_rule_entry(const jam_string &module, const jam_string &rule_name, rule_func rule
		,jam_rule::param_type tp1,const jam_string &nm1
		);
	native_rule_entry(const jam_string &module, const jam_string &rule_name, rule_func rule
		,jam_rule::param_type tp1,const jam_string &nm1
		,jam_rule::param_type tp2,const jam_string &nm2
		);
	native_rule_entry(const jam_string &module, const jam_string &rule_name, rule_func rule
		,jam_rule::param_type tp1,const jam_string &nm1
		,jam_rule::param_type tp2,const jam_string &nm2
		,jam_rule::param_type tp3,const jam_string &nm3
		);
	native_rule_entry(const jam_string &module, const jam_string &rule_name, rule_func rule
		,jam_rule::param_type tp1,const jam_string &nm1
		,jam_rule::param_type tp2,const jam_string &nm2
		,jam_rule::param_type tp3,const jam_string &nm3
		,jam_rule::param_type tp4,const jam_string &nm4
		);
	native_rule_entry(const jam_string &module, const jam_string &rule_name, rule_func rule
		,jam_rule::param_type tp1,const jam_string &nm1
		,jam_rule::param_type tp2,const jam_string &nm2
		,jam_rule::param_type tp3,const jam_string &nm3
		,jam_rule::param_type tp4,const jam_string &nm4
		,jam_rule::param_type tp5,const jam_string &nm5
		);

	void register_in_context(jam_context *ctx);
	
private:
	rule_func rule_;
	jam_string module_;
	jam_string rule_name_;
	param_name_list param_names_;
	param_type_list param_types_;
};

JAMLIB_EXPORT void create_natives_for_context(jam_context *ctx);

#endif //NATIVE_HPP
